|
|
|
|
|
|
|
Puzzle 23
There Is a Question in There Somewhere |
|
|
|
|
|
|
|
|
Where do these puzzles come from? |
|
|
|
|
|
|
|
|
One of my goals for this book was to develop puzzles that are real. What do I mean by this? I've sometimes found that sample code in books is somewhat artificial. For example, object-oriented programming is demonstrated by using animalsyou have a class named Animal with inherited classes that are specific types of animals, such as dog or cat. This is fine if you're running a zoo, but let's face it: Most programmers don't create software for zoos. They may work in offices that bear some resemblance to zoos, but I digress. My point is that book examples are sometimes just a bit irrelevant. |
|
|
|
|
|
|
|
|
With this book, I'm fairly confident I've avoided that trap. How can I be so sure? Rather than explain, I thought I would demonstrate. Consider this, if you will, a puzzle on how to create these types of puzzles. |
|
|
|
|
|
|
|
|
First, the inspiration for the puzzle. |
|
|
|
|
|
|
|
|
The following is a real inquiry I received about two days ago: |
|
|
|
 |
|
 |
|
|
Dan, you've been very helpful in the pastI'm hoping you can help with what I'm sure is actually a simple question. |
|
|
|
 |
|
 |
|
|
I'm trying to use the user_info_2 structure with the NetAddUser function from VBA. Part of this structure is: PBYTE usri2_logon_hours; points to a 21-byte (168 bits) bit string that specifies . . . |
|
|
|
 |
|
 |
|
|
How do I include this in my type declaration? Also, there is a constant in the C header as: |
|
|
|
 |
|
 |
|
|
#define USER_MAXSTORAGE_UNLIMITED ((unsigned long)-1L) |
|
|
|
 |
|
 |
|
|
Isn't this a contradiction? |
|
|
|
 |
|
 |
|
|
Should I just declare this as a long constant with the value of 1? Thanks in advance! |
|
|
|
|
|
|
|
|
Now, I don't want to give you the impression that I answer all of the questions I receive. Time does not permit me to answer more than a few. In this case, however, the question struck me as perfect for this book. I gave my correspondent a |
|
|
|
|
|